package com.dubbo.provider;

import com.dubbo.provider.config.HttpProtocol;
import com.dubbo.provider.config.Protocol;
import com.dubbo.provider.config.ProtocolFactory;
import com.dubbo.provider.map.ProtocolRegisterMap;
import com.dubbo.provider.map.RegisterMap;

import com.dubbo.provider.service.UserInfoServiceImpl;
import com.dubbo.provider.service.UserService;
import com.dubbo.provider.util.Url;
import org.apache.catalina.LifecycleException;

import java.io.IOException;

/**
 * @description: 启动类
 * @author: 石亚宁
 * @create: 2020-05-28 15:24
 **/

public class ProviderAppication {
	public static void main(String[] args) throws IOException, LifecycleException {
		//服务本地注册
		RegisterMap.add(UserService.class.getName(),UserInfoServiceImpl.class);
		//服务远程暴露
		Url url=new Url("127.0.0.1",8080);
		ProtocolRegisterMap protocolRegisterMap=new ProtocolRegisterMap();
		protocolRegisterMap.register(UserService.class.getName(),url);
		//启动tomcat，处理请求
		Protocol tomcatServer= ProtocolFactory.getProtocol();
		tomcatServer.start(url);
		System.in.read();

	}

}
